<template>
  <div id="main-content" v-loading="loading" element-loading-text="加载中...">
    <div class="content">
      <el-page-header @back="goBackToList" title="返回列表" content="预约信息"></el-page-header>
      <div id="subscribeInfo-content">
          <el-form ref="form" :model="subscribeInfo" label-width="120px">
              <el-form-item label="预约楼盘">
                <el-input v-model="subscribeInfo.hourseName" disabled></el-input>
              </el-form-item>
              <el-form-item label="客户称呼">
                <el-input v-model="subscribeInfo.customerName" disabled></el-input>
              </el-form-item>
              <el-form-item label="客户电话号码">
                <el-input v-model="subscribeInfo.telephone" disabled></el-input>
              </el-form-item>
              <el-form-item label="创建时间">
                <el-input v-model="subscribeInfo.createTime" disabled></el-input>
              </el-form-item>
              <el-form-item label="预约看房时间">
                <el-input v-model="subscribeInfo.appointmentTime" disabled></el-input>
              </el-form-item>
              <el-form-item label="微信号">
                <el-input v-model="subscribeInfo.wechat" disabled></el-input>
              </el-form-item>
              <el-form-item label="备注">
                <el-input v-model="subscribeInfo.remark" disabled></el-input>
              </el-form-item>
          </el-form>
      </div>
    </div>
  </div>
</template>
<script>

export default {
  data() {
    return {
      subscribeId:"",
      subscribeInfo:{}
    };
  },
  methods: {
    getSubscribeInfo(subscribeId) {
      this.loading = true;
      this.$http.get("/api/subscribe/get/" + subscribeId).then(response => {
        if (response) {
          this.subscribeInfo = response.data;
          var appointmentTime = this.subscribeInfo.appointmentTime;
          if(appointmentTime){
            this.subscribeInfo.appointmentTime = this.$moment(appointmentTime).format("YYYY-MM-DD h:mm");
          }
          var createTime = this.subscribeInfo.createTime;
          this.subscribeInfo.createTime = this.$moment(createTime).format("YYYY-MM-DD H:mm:ss");
          this.loading = false;
        }
      });
    },
    goBackToList(){
      this.$router.push("/subscribeList");
    }
  },
  created() {
    this.subscribeId = this.$route.params.subscribeId;
    if (this.subscribeId) {
      this.getSubscribeInfo(this.subscribeId);
    }
  }
};
</script>
<style>
#subscribeInfo-content{
  margin-top: 50px;
}
</style>